home *** CD-ROM | disk | FTP | other *** search
/ Amiga Inside! / Amiga FD Inside (1995)(Ultramax).iso / berndspd / disktools / boottool / bbsources / memtestbb_1.2.asm < prev    next >
Encoding:
Assembly Source File  |  1994-04-26  |  4.6 KB  |  213 lines

  1.  
  2. ; Assembler: DevPac 2.14
  3.  
  4. ; use Tab 11
  5.  
  6. ; *****  Revision History  *****
  7. ;
  8. ;    V1.0    testet auf NTSC- / PAL-Display
  9. ;        testet Vectoren Cool, Cold, KickMemPtr,
  10. ;        KickTagPtr, KickCheckSumPtr
  11. ;         --> einer ungleich NULL --> rote CopperList
  12. ;         --> alle NULL --> grüne CopperList
  13. ;    V1.1    wie 1.0
  14. ;        statt roter CopperList ein Alert, der die
  15. ;        Werte als Hex anzeigt
  16. ;    V1.2    wie V1.1, aber Code optimiert
  17.  
  18.  
  19.     opt    o+,p+
  20.  
  21. ; *****  MemTest-Bootblock V1.2  *****
  22.  
  23. bootcode    dc.l    $444f5300        ; DOS-Disk OFS
  24.     dc.l    $00000000        ; CheckSum
  25.     dc.l    $00000370        ; RootBlock pointer
  26.  
  27. ; -----  Standart-DOS-Bootcode
  28.     
  29. .dos_boot    lea    exp_lib(pc),a1    ; Standard OS2.0 code
  30.     moveq    #37,d0
  31.     jsr    -552(a6)        ; _LVOOpenLibrary
  32.     tst.l    d0
  33.     beq.s    .no_explib
  34.     move.l    d0,a1
  35.     bset    #6,34(a1)
  36.     jsr    -414(a6)        ; _LVOCloseLibrary
  37. .no_explib    lea    dos_lib(pc),a1
  38.     jsr    -96(a6)        ; _LVOFindResident
  39.     tst.l    d0
  40.     beq.s    .not_found
  41.     move.l    d0,a0
  42.     movea.l    22(a0),a0
  43.     moveq    #0,d0
  44.     bra.s    .own_boot
  45. .not_found    moveq    #-1,d0    
  46.  
  47. ; -----  MemTest-Routine
  48.     
  49. .own_boot    movem.l    d0-d7/a0-a6,-(sp)
  50.     cmp.b    #50,530(a6)    ; NTSC-Display ?? (PAL -> 50Hz)
  51.     bne    .softreset
  52.     cmp.l    #0,42(a6)        ; ColdCapture
  53.     bne    .vecs_bad
  54.     cmp.l    #0,46(a6)        ; CoolCapture
  55.     bne    .vecs_bad
  56.     cmp.l    #0,546(a6)        ; KickMemPtr
  57.     bne    .vecs_bad
  58.     cmp.l    #0,550(a6)        ; KickTagPtr
  59.     bne    .vecs_bad
  60.     cmp.l    #0,554(a6)        ; KickCheckSumPtr
  61.     bne    .vecs_bad
  62.  
  63. ; -----  grüne CopperListe ausgeben, warten und BB beenden
  64.  
  65. .vecs_ok    move.l    #cop_end-cop_start,d0
  66.     moveq    #2,d1
  67.     jsr    -198(a6)        ; _LVOAllocMem
  68.     lea    cop_adress(pc),a0
  69.     move.l    d0,(a0)
  70.     beq.s    .back_1
  71.     lea    cop_start(pc),a0
  72.     move.l    cop_adress(pc),a1
  73.     move.l    #cop_end-cop_start-1,d0
  74. .cl_copy    move.b    (a0)+,(a1)+
  75.     dbf    d0,.cl_copy
  76.     jsr    -132(a6)        ; _LVOForbid
  77.     lea    $dff000,a5
  78.     move.w    #$03a0,$96(a5)    ; DMACON
  79.     move.l    cop_adress(pc),$80(a5) ; COP1LCH
  80.     move.w    #0,$88(a5)        ; COPJMP1
  81.     move.w    #$8280,$96(a5)    ; DMACON
  82.     moveq    #$c,d1
  83.     move.l    #$ffff,d0
  84. .wait_loop    nop            ; Warteschleife (Polling)
  85.     dbra    d0,.wait_loop
  86.     dbra    d1,.wait_loop
  87.     lea    gfx_lib(pc),a1
  88.     moveq    #33,d0
  89.     jsr    -552(a6)        ; _LVOOpenLibrary
  90.     move.l    d0,a4
  91.     move.l    38(a4),$80(a5)    ; COP1LCH
  92.     move.w    #0,$88(a5)        ; COPJMP1
  93.     move.w    #$83e0,$96(a5)    ; DMACON
  94.     jsr    -138(a6)        ; _LVOPermit
  95.     move.l    cop_adress(pc),a1
  96.     move.l    #cop_end-cop_start,d0
  97.     jsr    -210(a6)        ; _LVOFreeMem
  98. .back_1    movem.l    (sp)+,d0-d7/a0-a6
  99.     rts
  100.  
  101. ; -----  Alert mit Meldung & Vektoren ausgeben
  102.  
  103. .vecs_bad    lea    bad_text(pc),a1
  104.     adda.l    #71,a1
  105.     move.l    42(a6),d0        ; ColdCapture
  106.     bsr    .bbbin2hex
  107.     adda.l    #36,a1
  108.     move.l    46(a6),d0        ; CoolCapture
  109.     bsr    .bbbin2hex
  110.     adda.l    #27,a1
  111.     move.l    546(a6),d0        ; KickMemPtr
  112.     bsr    .bbbin2hex
  113.     adda.l    #36,a1
  114.     move.l    550(a6),d0        ; KickTagPtr
  115.     bsr    .bbbin2hex
  116.     adda.l    #33,a1
  117.     move.l    554(a6),d0        ; KickCheckSumPtr
  118.     bsr    .bbbin2hex
  119.     adda.l    #35,a1
  120.     move.l    300(a6),d0        ; ResModules
  121.     bsr    .bbbin2hex
  122.  
  123.     lea    int_lib(pc),a1
  124.     moveq    #33,d0
  125.     jsr    -552(a6)        ; _LVOOpenLibrary
  126.     move.l    d0,a6
  127.     beq.s    .back_2
  128.     lea    bad_text(pc),a0
  129.     moveq    #1,d0
  130.     moveq    #95,d1
  131.     jsr    -90(a6)        ; _LVODisplayAlert
  132.     cmp.l    #0,d0
  133.     beq.s    .coldreset
  134.     move.l    a6,a1
  135.     move.l    4.w,a6
  136.     jsr    -414(a6)        ; _LVOCloseLibrary
  137. .back_2    movem.l    (sp)+,d0-d7/a0-a6
  138.     rts
  139.  
  140. ; -----  ColdReset ausführen 
  141.  
  142. .coldreset    move.l    4.w,a6
  143.     jsr    -132(a6)        ; _LVOForbid
  144.  
  145.     move.l    #0,38(a6)        ; Exec_ChkBase
  146.     move.l    #0,42(a6)        ; ColdCapture
  147.     move.l    #0,46(a6)        ; CoolCapture
  148.     move.l    #0,82(a6)        ; Exec_ChkSum
  149.     move.l    #0,300(a6)        ; ResModules
  150.     move.l    #0,546(a6)        ; KickMemPtr
  151.     move.l    #0,550(a6)        ; KickTagPtr
  152.     move.l    #0,554(a6)        ; KickCheckSumPtr
  153.     
  154. ; -----  Soft-Reset ausführen 
  155.     
  156. .softreset    jsr    -150(a6)        ; _LVOSuperState
  157.     move.l    #$fc0002,$20.w
  158.     movea.l    #$f80002,a0
  159.     reset            ; reservierter Befehl (SuperVisor)
  160.     jmp    (a0)        ; an Reset-Routine springen
  161.  
  162. ; -----  Bin -> Hex Konvertieren der Werte in d0.l nach a1
  163.  
  164. .bbbin2hex    adda.l    #8,a1
  165.     lea    hextab(pc),a0
  166.     moveq    #7,d1
  167. .loop    move.l    d0,d2
  168.     and.l    #15,d2
  169.     move.b    (a0,d2),-(a1)
  170.     lsr.l    #4,d0
  171.     dbra    d1,.loop
  172.     rts
  173.  
  174. ; -----  CopperList
  175.  
  176. cop_start    dc.w    $180,$00d0        ; hellgrün
  177.     dc.w    $7007,$fffe
  178.     dc.w    $180,$0080        ; grün
  179.     dc.w    $d00d,$fffe
  180.     dc.w    $180,$0040        ; dunkelgrün
  181.     dc.w    $ffff,$fffe
  182. cop_end
  183.  
  184. ; -----  Variablen/Konstanen
  185.  
  186. cop_adress    dc.l    0
  187.  
  188. hextab    dc.b    "0123456789ABCDEF"
  189.  
  190. exp_lib    dc.b    "expansion.library",0
  191. dos_lib    dc.b    "dos.library",0
  192. gfx_lib    dc.b    "graphics.library",0
  193. int_lib    dc.b    "intuition.library",0
  194.  
  195. bad_text    dc.b    0,128,15
  196.     dc.b    "Some of your Vectors are not pointing to zero !!"
  197.     dc.b    0,$ff,0,80,40
  198.     dc.b    "ColdCapture:                        CoolCapture:           "
  199.     dc.b    0,$ff,0,80,50
  200.     dc.b    "KickMemPtr:                         KickTagPtr:            "
  201.     dc.b    0,$ff,0,80,60
  202.     dc.b    "KickCheckSumPtr:                    ResModulesBase:           "
  203.     dc.b    0,$ff,0,24,85
  204.     dc.b    "* [LMB] to continue *                               * [RMB] to ColdReset *"
  205.     dc.b    0,0
  206.  
  207.     dc.b    0,"** MemTest V1.2 - 1993 by Jens Troeger **"
  208.  
  209. bootcode_end
  210.  
  211.     end
  212.  
  213.